package com.seal.commons.infrastructure.rocketmq.autoConfigure;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName:ProducerProperties <br/>
 * Func: producer 配置文件<br/>
 * Date:     2019-05-31 13:28 <br/>
 *
 * @author yong.huang
 * @see
 * @since JDK 1.8
 */

@Data
@Configuration
@ConfigurationProperties(prefix = RocketMQProperties.ROCKETMQ_PROPERTIES_PREFIX)
public class RocketMQProperties {

    public RocketMQProperties() {
    }

    public static final String  ROCKETMQ_PROPERTIES_PREFIX = "spring.seal.rocketmq";

    private String nameSrvAdder;

    private final Producer producer = new Producer();

    private final Consumer consumer = new Consumer();


    @Data
    public static class Producer{

        private int defaultTopicQueueNums = 4;

        private int sendMsgTimeout = 3000;

        private int maxMessageSize = 4194304;

        private int compressMsgBodyOverHowmuch = 4096;

        private int retryTimesWhenSendFailed = 3;

        private boolean retryAnotherBrokerWhenNotStoreOK = false;
    }

    @Data
    public static class Consumer{

        private int consumeThreadMin = 20;

        private int consumeThreadMax = 64;

        private int consumeConcurrentlyMaxSpan = 2000;

        private int pullThresholdForQueue = 1000;

        private long pullInterval = 0L;

        private int pullBatchSize = 32;
    }


}
